//
//  HWzuixingdemeirienwuViewController.m
//  HWanGame
//
//  Created by 陈道斌 on 2021/1/19.
//  Copyright © 2021 Chendaobin. All rights reserved.
//

#import "HWzuixingdemeirienwuViewController.h"
#import "HWjifenRenwuTableViewCell.h"
 

@interface HWzuixingdemeirienwuViewController ()<UITableViewDelegate,UITableViewDataSource>
@property(strong,nonatomic) UITableView *mainaTableVie;
@property(strong,nonatomic) NSArray *dataArr;
@property(strong,nonatomic) NSArray *biaotiArr;
@property(strong,nonatomic) NSArray *icoArr;
@property(strong,nonatomic) UILabel *jifenLabel; //积分Label
@property(strong,nonatomic) NSArray *shujuArr;
@property(strong,nonatomic) UIButton *shuaxingBut;

@property(strong,nonatomic)UILabel *jifenshituLabel; // 最新的积分金额


@end

@implementation HWzuixingdemeirienwuViewController



-(UITableView *)mainaTableVie {

    if (_mainaTableVie == nil
        ) {
        _mainaTableVie = [[UITableView alloc]initWithFrame:CGRectMake(0, 190, kScreenW,kScreenH-(190)) style:UITableViewStylePlain];
         _mainaTableVie.delegate = self;
         _mainaTableVie.dataSource = self;
        _mainaTableVie.backgroundColor = [UIColor whiteColor];
        _mainaTableVie.backgroundColor = [UIColor clearColor];
        _mainaTableVie.separatorStyle = UITableViewCellSeparatorStyleNone;

    }
    return   _mainaTableVie ;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self shezhichangyongdeshuxiing];
    
    [self setupUI];
    
    [self fasongwangluoqing];
}


- (void)fasongwangluoqing {
    
      
    
       //重制密码
    
        int  r =  [WMUtil getRandomNumber:101 to:998];
      
      
         NSString *uidStr = [NSString stringWithFormat:@"%@",[HWLocallyStoredData getLoginUserID]];
         NSString *tStr = [NSString stringWithFormat:@"%ld%d",[WMUtil getTimeSp],r];
         
      
         
         NSString *singStr = [NSString stringWithFormat:@"%@%@%@",uidStr,tStr,@"fsd213ewdsadqwe2121213edsad"];
         
         NSString *singMD5 = [WMUtil md5HexDigest:singStr];

    
         NSDictionary *parametes = @{
                                           
                                            @"ios" : @"1",
                                            @"uid" :uidStr,
                                            @"t" : tStr,
                                            @"sign" : singMD5,
                                            @"language":[HWjianzhiduiObject returnLanguageAcquisition],
                                         
                                            };
    
    
    [HWWebUtils do4GetWithParameters:parametes hiddenparameterStr:HW_dayrenwu progress:nil success:^(id  _Nullable response) {
        
        NSString *codeStr =  [NSString stringWithFormat:@"%@",response[@"code"]];
                       
                if ([codeStr intValue] == 1) {
                           
                          // [MBProgressHUD showSuccess:response[@"message"]];
                           
                           self.shujuArr = response[@"data"];
                           
//                           NSString *jifen = [NSString stringWithFormat:@"我的积分：%@",response[@"message"]];
//                           CGSize size =  [WMUtil strName:jifen fontSize:[UIFont systemFontOfSize:14] boundingRectWithSize:CGSizeMake(1000, 200)];
//                           self.jifenLabel.attributedText = [WMUtil  attributedStringWithText:jifen withRangText:response[@"message"] withColor:RGB(253, 178, 50) withFont:[UIFont systemFontOfSize:14]];
//                           self.jifenLabel.frame = CGRectMake(12, 0, size.width, 40);
//                           self.shuaxingBut.frame =    CGRectMake(self.jifenLabel.right+5, 0, 30, 40);
//                           self.jifenshituLabel.text = [NSString stringWithFormat:@"%@",response[@"message"]];
//
                           [self.mainaTableVie reloadData];
                           
                           
                
              } else  {
                           
                            [MBProgressHUD showError:response[@"message"]];
                           
            }
                    
        
    } failure:^(NSString *error) {
        
         [MBProgressHUD showError:@"兑换失败"];
        
    }];
            
//           [HWWebUtils doGetWithParameters:parametes progress:nil success:^(id response) {
//
//
//
//
//                NSString *codeStr =  [NSString stringWithFormat:@"%@",response[@"code"]];
//
//                if ([codeStr intValue] == 1) {
//
//                   // [MBProgressHUD showSuccess:response[@"message"]];
//
//                    self.shujuArr = response[@"data"];
//
//                    NSString *jifen = [NSString stringWithFormat:@"我的积分：%@",response[@"message"]];
//                    CGSize size =  [WMUtil strName:jifen fontSize:[UIFont systemFontOfSize:14] boundingRectWithSize:CGSizeMake(1000, 200)];
//                    self.jifenLabel.attributedText = [WMUtil  attributedStringWithText:jifen withRangText:response[@"message"] withColor:RGB(253, 178, 50) withFont:[UIFont systemFontOfSize:14]];
//                    self.jifenLabel.frame = CGRectMake(12, 0, size.width, 40);
//                    self.shuaxingBut.frame =    CGRectMake(self.jifenLabel.right+5, 0, 30, 40);
//                    self.jifenshituLabel.text = [NSString stringWithFormat:@"%@",response[@"message"]];
//
//                    [self.mainaTableVie reloadData];
//
//
//
//                } else  {
//
//                     [MBProgressHUD showError:response[@"message"]];
//
//                }
//
//
//
//            } failure:^(NSString *error) {
//                [MBProgressHUD showError:@"兑换失败"];
//
//
//            }];
//
//
    
    
}






- (void)shezhichangyongdeshuxiing {
    
    self.icoArr = @[@"welfare_signin",@"welfare_new",@"welfare_message",@"welfare_game",@"welfare_share"];
    self.dataArr = @[@"每日签到",@"新手任务",@"每日任务",@"游戏评论",@"邀请好友"];
    
    
    
//    self.dataArr =  @[[HWjianzhiduiObject keylocalization:@"每日签到"],[HWjianzhiduiObject keylocalization:@"新手任务"],[HWjianzhiduiObject keylocalization:@"每日任务"],[HWjianzhiduiObject keylocalization:@"每日签到"]];
    
    self.biaotiArr = @[@"签到得积分，连续签到积分翻倍哦！",@"完成新手任务，送海量积分哦！",@"每天福利等您享，积分送不停！",@"优质的评论信息可以获得积分奖励哦！",@"独乐乐不如众乐乐，快去邀请好友吧！"];
    
    // 重置密码
    
    
}


- (void)setupUI {
   
    self.view.backgroundColor = [UIColor whiteColor];
    self.view.backgroundColor = RGB(242, 242, 242);
    [self setUPbeijingView];
    
    [self navigaView];
    
    self.mainaTableVie.layer.cornerRadius = 3;
    self.mainaTableVie.layer.masksToBounds = YES;
    self.mainaTableVie.scrollEnabled = NO;
    [self.view addSubview:self.mainaTableVie];
    
    
    
}


- (void)setUPbeijingView {
    
    UIView *beijingView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 230)];
    beijingView.backgroundColor = RGB(242, 242, 242);
  //   beijingView.backgroundColor =  [UIColor bm_colorGradientChangeWithSize:CGSizeMake(kScreenW, 138+CF_StatusBarHeight) direction:IHGradientChangeDirectionVertical startColor:RGB(73, 74, 86) endColor:RGB(32, 32, 42)];
    beijingView.backgroundColor  = RGB(255, 255, 255);
    
    [self.view addSubview:beijingView];
    
    UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 230)];
    imageView.image = [UIImage imageNamed:@"meirirenwu_ico"];
    imageView.backgroundColor = [UIColor redColor];
    imageView.contentMode = UIViewContentModeScaleToFill;
    imageView.hidden = NO;
    [beijingView addSubview:imageView];
    
    
    
    
    
    
  //   meirirenwu_ico
    
//    UIImageView *jingxiang = [[UIImageView alloc]initWithFrame:CGRectMake(kScreenW-149-10, 165+CF_StatusBarHeight-124-5, 149, 124)];
//    // jingxiang.image = [UIImage imageNamed:@"welfare_con"];
//   // jingxiang.backgroundColor = [UIColor yellowColor];
//    jingxiang.hidden = YES;
//    [imageView addSubview:jingxiang];
//
//
//    UIImageView *renwujifenwenziimageview = [[UIImageView alloc]initWithFrame:CGRectMake((kScreenW-147*CFLScaleValue-149-10)/2, 165+CF_StatusBarHeight-50*CFLScaleValue-40, 147*CFLScaleValue, 50*CFLScaleValue)];
//    renwujifenwenziimageview.image = [UIImage imageNamed:@"welfare_message_tit"];
//   // renwujifenwenziimageview.backgroundColor = [UIColor redColor];
//    [imageView addSubview:renwujifenwenziimageview];
//
//
//
//
//    UIButton *jifenbutt = [UIButton  createButtonWithTitle:@"我的积分" Image:@"zongjifenico" Target:nil Selector:nil];
//    jifenbutt.frame = CGRectMake(20, CF_StatusBarHeight+44+20, 80, 16);
//    jifenbutt.backgroundColor = [UIColor clearColor];
//    [jifenbutt layoutButtonWithEdgeInsetsStyle:MKButtonEdgeInsetsStyleLeft imageTitleSpace:10];
//    [self.view   addSubview:jifenbutt];
//
//    self.jifenshituLabel  = [[UILabel alloc]initWithFrame:CGRectMake(42, jifenbutt.bottom+6, 300, 32)];
//    self.jifenshituLabel.text = @"310";
//    self.jifenshituLabel.font = [UIFont systemFontOfSize:20];
//    self.jifenshituLabel.textColor = RGB(255, 255, 255);
//    [self.view addSubview: self.jifenshituLabel];
//
//
//    UIButton *fanhuiBut = [UIButton buttonWithType:UIButtonTypeCustom];
//     fanhuiBut.frame = CGRectMake(kScreenW-20-66, CF_StatusBarHeight+44+45 , 66, 26);
//     fanhuiBut.backgroundColor = [UIColor  clearColor];
//    //  [fanhuiBut setImage:[UIImage imageNamed:@"fanhuijiemianIco"] forState:UIControlStateNormal];
//     [fanhuiBut addTarget:self action:@selector(jifenshang) forControlEvents:UIControlEventTouchUpInside];
//    [fanhuiBut setTitle:@"积分商城" forState:UIControlStateNormal];
//    [fanhuiBut  setTitleColor:RGB(255, 255, 255) forState:UIControlStateNormal];
//    fanhuiBut.layer.cornerRadius = 13;
//    fanhuiBut.layer.masksToBounds = YES;
//    fanhuiBut.titleLabel.font = [UIFont  systemFontOfSize:13];
//    fanhuiBut.backgroundColor =  [UIColor bm_colorGradientChangeWithSize:CGSizeMake(66, 26) direction:IHGradientChangeDirectionLevel startColor:RGB(255, 182, 10) endColor:RGB(246, 106, 5)];
//    [self.view addSubview:fanhuiBut];
//
//
//
//    UIButton *choujiangBut = [UIButton buttonWithType:UIButtonTypeCustom];
//     choujiangBut.frame = CGRectMake(kScreenW-20-66-12-66, CF_StatusBarHeight+44+45 , 66, 26);
//     choujiangBut.backgroundColor = [UIColor  clearColor];
//    //  [fanhuiBut setImage:[UIImage imageNamed:@"fanhuijiemianIco"] forState:UIControlStateNormal];
//     [choujiangBut addTarget:self action:@selector(choujiangBut) forControlEvents:UIControlEventTouchUpInside];
//    [choujiangBut setTitle:@"积分抽奖" forState:UIControlStateNormal];
//    [choujiangBut  setTitleColor:RGB(255, 255, 255) forState:UIControlStateNormal];
//    choujiangBut.layer.cornerRadius = 13;
//    choujiangBut.layer.masksToBounds = YES;
//    choujiangBut.titleLabel.font = [UIFont  systemFontOfSize:13];
//    choujiangBut.backgroundColor =  [UIColor bm_colorGradientChangeWithSize:CGSizeMake(66, 26) direction:IHGradientChangeDirectionLevel startColor:RGB(255, 182, 10) endColor:RGB(246, 106, 5)];
//    [self.view addSubview:choujiangBut];
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//    UIView *jifenView = [[UIView alloc]initWithFrame:CGRectMake(15, 165+CF_StatusBarHeight+20-40, kScreenW-15*2, 40)];
//   jifenView.backgroundColor = [UIColor whiteColor];
//    jifenView.layer.cornerRadius = 6;
//    jifenView.layer.masksToBounds = YES;
//    jifenView.hidden = YES;
//    [beijingView addSubview:jifenView];
//
//    UIButton *jifengbuton =  [UIButton buttonWithType:UIButtonTypeCustom];
//    [jifengbuton setTitle:@"积分商城" forState:UIControlStateNormal];
//    jifengbuton.frame = CGRectMake( kScreenW-15*2-73-15, 8, 73, 25);
//    jifengbuton.layer.cornerRadius = 12;
//    jifengbuton.layer.masksToBounds = YES;
//    jifengbuton.backgroundColor = RGB(233, 241, 255);
//    jifengbuton.titleLabel.font = [UIFont systemFontOfSize:12];
//    [jifengbuton setTitleColor:RGB(26, 113, 255) forState:UIControlStateNormal];
//    [jifengbuton addTarget:self action:@selector(jifengbutonTap) forControlEvents:UIControlEventTouchUpInside];
//
//    [jifenView addSubview:jifengbuton];
//
//
//
//
//    CGSize size =  [WMUtil strName:@"我的积分：500" fontSize:[UIFont systemFontOfSize:14] boundingRectWithSize:CGSizeMake(1000, 200)];
//    self.jifenLabel = [[UILabel alloc]initWithFrame:CGRectMake(12, 0, size.width, 40)];
//    self.jifenLabel.text = @"我的积分：500";
//    self.jifenLabel.font = [UIFont systemFontOfSize:14];
//    self.jifenLabel.textColor = RGB(51, 51, 51);
//    [jifenView addSubview:   self.jifenLabel];
//
//     self.jifenLabel.attributedText = [WMUtil  attributedStringWithText:@"我的积分：500" withRangText:@"500" withColor:RGB(253, 178, 50) withFont:[UIFont systemFontOfSize:14]];
//
//
//    UIButton *shulianbuton =  [UIButton buttonWithType:UIButtonTypeCustom];
//    shulianbuton.frame = CGRectMake(self.jifenLabel.right+5, 0, 30, 40);
//    [shulianbuton setImage:[UIImage imageNamed:@"welfare_refresh"] forState:UIControlStateNormal];
//    self.shuaxingBut = shulianbuton;
//    [shulianbuton addTarget:self action:@selector(shuxingBut) forControlEvents:UIControlEventTouchUpInside];
//
//    [jifenView addSubview:shulianbuton];
//
    
    
}



- (void)shuxingBut {
    
    
    DLog(@" shuxingBut");
    
    [self fasongwangluoqing];
    
}


- (void)navigaView  {
   
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(10,StatusBarHeight+17, 40, 17);
   // button.backgroundColor = [UIColor redColor];
    [button setImage:[UIImage imageNamed:@"details_back"] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(buttonTap) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    
    UILabel *textlabel = [[UILabel alloc]initWithFrame:CGRectMake((kScreenW-70)/2, StatusBarHeight+17, 70, 17)];
 
    textlabel.textAlignment =  NSTextAlignmentCenter;
    textlabel.textColor = [UIColor whiteColor];
    textlabel.hidden = YES;
    textlabel.font = [UIFont systemFontOfSize:16];
    [self.view addSubview:textlabel];
    
    
    
    UILabel *jifenmingxitextlabel = [[UILabel alloc]initWithFrame:CGRectMake((kScreenW-70)-20, StatusBarHeight+17, 70, 17)];
    jifenmingxitextlabel.text = @"积分明细";
    jifenmingxitextlabel.textAlignment =  NSTextAlignmentCenter;
       jifenmingxitextlabel.textColor = [UIColor whiteColor];
    jifenmingxitextlabel.hidden = YES;
       jifenmingxitextlabel.font = [UIFont systemFontOfSize:14];
       [self.view addSubview:jifenmingxitextlabel];
    
    
    
    
    
       
       
    
    
    
    
    
  //  jiludushao
    
       UIButton *lishijilubutton = [UIButton buttonWithType:UIButtonTypeCustom];
       lishijilubutton.frame = CGRectMake(kScreenW-35,StatusBarHeight+17, 17, 17);
      // button.backgroundColor = [UIColor redColor];
       lishijilubutton.hidden = YES;
       [lishijilubutton setImage:[UIImage imageNamed:@"jiludushao"] forState:UIControlStateNormal];
       [lishijilubutton addTarget:self action:@selector(jiludushaoTap) forControlEvents:UIControlEventTouchUpInside];
       [self.view addSubview:lishijilubutton];
    

}




- (void)buttonTap {
    
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)jiludushaoTap {
    DLog(@"记录");

    
  
    
}




- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
   // [self.navigationController setNavigationBarHidden:YES animated:animated];
    [self.navigationController setNavigationBarHidden:YES];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    
    [self.navigationController setNavigationBarHidden:NO];
    
    
}


#pragma  mark -------- UITableViewDelegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    
    return self.shujuArr.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//    static NSString *cellID = @"cellID";
//
//    HWRenwupingluoTableViewCell  *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
//
//
//    if (!cell) {
//        cell =   [[NSBundle mainBundle]loadNibNamed:@"HWRenwupingluoTableViewCell" owner:nil options:nil].firstObject;
//
//    }
//   // cell.textLabel.text = @"111";
//
//  //  cell.icoiamgeView.image = [UIImage imageNamed:self.icoArr[indexPath.row]];
//    cell.selectionStyle =  UITableViewCellSelectionStyleNone;
//    cell.backgroundColor = [UIColor whiteColor];
//    cell.backgroundColor =  RGB(247, 247, 247);
////    NSString *icostr = self.icoArr[indexPath.row];
////    cell.selectionStyle =  UITableViewCellSelectionStyleNone;
////
////    cell.icoiamgeView.image = [UIImage imageNamed:icostr];
////    cell.mianshuLabel.text = self.dataArr[indexPath.row];
////    cell.jiehsoLabel.text = self.biaotiArr[indexPath.row];
//    NSDictionary *dic = self.shujuArr[indexPath.row];
//    [cell.icoiamgeView sd_setImageWithURL:[NSURL URLWithString:dic[@"icon"]] placeholderImage:nil];
//    cell.mianshuLabel.text = [NSString stringWithFormat:@"%@",dic[@"name"]];
//    cell.jiehsoLabel.text = [NSString stringWithFormat:@"%@",dic[@"summary"]];
//
//
    
 //  HWjifenRenwuTableViewCell
    
    
      static NSString *cellID = @"cellID";
        
        HWjifenRenwuTableViewCell  *cell = [tableView dequeueReusableCellWithIdentifier:cellID];

        
        if (!cell) {
            cell =   [[NSBundle mainBundle]loadNibNamed:@"HWjifenRenwuTableViewCell" owner:nil options:nil].firstObject;
            
        }
       // cell.textLabel.text = @"111";
        
      //  cell.icoiamgeView.image = [UIImage imageNamed:self.icoArr[indexPath.row]];
        cell.selectionStyle =  UITableViewCellSelectionStyleNone;
        
        cell.backgroundColor =  [UIColor clearColor];
    //    NSString *icostr = self.icoArr[indexPath.row];
    //    cell.selectionStyle =  UITableViewCellSelectionStyleNone;
    //
    //    cell.icoiamgeView.image = [UIImage imageNamed:icostr];
    //    cell.mianshuLabel.text = self.dataArr[indexPath.row];
    //    cell.jiehsoLabel.text = self.biaotiArr[indexPath.row];
        NSDictionary *dic = self.shujuArr[indexPath.row];
        [cell.tupianImageView sd_setImageWithURL:[NSURL URLWithString:dic[@"icon"]] placeholderImage:nil];
        cell.mwiriqianlabel.text = [NSString stringWithFormat:@"%@",dic[@"name"]];
        cell.xiabianLabel.text = [NSString stringWithFormat:@"%@",dic[@"point"]];
    cell.contentView.backgroundColor = [UIColor clearColor];
    cell.lingquBut.hidden  = NO;
    NSString *status = [NSString stringWithFormat:@"%@",dic[@"status"]];
    
    
    if ([status isEqualToString:@"0"]) {
         
        
        
       //  [cell.lingquBut setTitle:@"未完成" forState:UIControlStateNormal];
        [cell.lingquBut setTitle:[HWjianzhiduiObject keylocalization:@"未完成"] forState:UIControlStateNormal];
        
    
    } else if ([status isEqualToString:@"1"]) {
        
        // [cell.lingquBut setTitle:@"领取" forState:UIControlStateNormal];
        
        [cell.lingquBut setTitle:[HWjianzhiduiObject keylocalization:@"领取"] forState:UIControlStateNormal];
        
        
    }else if ([status isEqualToString:@"2"]) {
        
        
        
       //  [cell.lingquBut setTitle:@"已领取" forState:UIControlStateNormal];
        
        
        [cell.lingquBut setTitle:[HWjianzhiduiObject keylocalization:@"已领取"] forState:UIControlStateNormal];
        
        
    }
    
    
    [cell.lingquBut addTarget:self action:@selector(liqujiekou:) forControlEvents:UIControlEventTouchUpInside];
    
    
//    if ([type intValue] == 0) {
//        cell.chaijijifenkaLabel.hidden = NO;
//
//        cell.chaijijifenkaLabel.text = @"VIP会员积分翻倍";
//
//    } else if ([type intValue] == 2 ) {
//
//         cell.chaijijifenkaLabel.hidden = NO;
//         cell.chaijijifenkaLabel.text = @"实名认证有好礼";
//
//    } else {
//
//         cell.chaijijifenkaLabel.hidden = YES;
//
//    }
      cell.chaijijifenkaLabel.hidden = YES;
    
       NSString *statan =    [NSString stringWithFormat:@"%@",dic[@"status"]];
    
    
    
  
       return  cell;
    
    
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    
    return 70;
    return  58;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    
    
    NSDictionary *dic = self.shujuArr[indexPath.row];
    NSString *nameStr =  [NSString stringWithFormat:@"%@",dic[@"name"]];
    
    
  
    
//    if (indexPath.row == 0 ) {
//
//
//    } else if (indexPath.row == 1) {
//
//        HWXingshouRenwuViewController *xingshou =   [[HWXingshouRenwuViewController alloc]init];
//        [self.navigationController pushViewController:xingshou animated:YES];
//
//
//
//    } else if (indexPath.row == 2) {
//
//        HWMeiRiRenWuViewController *meiriRenWu = [[HWMeiRiRenWuViewController alloc]init];
//        [self.navigationController pushViewController:meiriRenWu animated:YES];
//
//    } else if (indexPath.row == 3) {
//
//
//
//    } else if (indexPath.row == 4) {
//
//        HWInviteFriendsViewController *inviteFriends = [[HWInviteFriendsViewController alloc]init];
//        [self.navigationController pushViewController:inviteFriends animated:YES];
//
//
//    }
//
//
    
}






- (void)liqujiekou : (UIButton *)sender{
    
    NSLog(@"%@",[[[sender superview] superview] superview]);
     
    HWjifenRenwuTableViewCell *cell =   [[[sender superview] superview] superview];
    NSIndexPath *index = [self.mainaTableVie indexPathForCell:cell];
       NSDictionary *dic = self.shujuArr[index.row];
     
     NSString *type = [NSString stringWithFormat:@"%@",dic[@"type"]];
     NSString *status = [NSString stringWithFormat:@"%@",dic[@"status"]];
    
    if ([status isEqualToString:@"1"] ) {
        
        
        int  r =  [WMUtil getRandomNumber:101 to:998];
                 
                 
                    NSString *uidStr = [NSString stringWithFormat:@"%@",[HWLocallyStoredData getLoginUserID]];
                    NSString *tStr = [NSString stringWithFormat:@"%ld%d",[WMUtil getTimeSp],r];
                    
                 
                    
                    NSString *singStr = [NSString stringWithFormat:@"%@%@%@",uidStr,tStr,@"fsd213ewdsadqwe2121213edsad"];
                    
                    NSString *singMD5 = [WMUtil md5HexDigest:singStr];

               
                    NSDictionary *parametes = @{
                                                      
                                                       @"ios" : @"1",
                                                       @"uid" :uidStr,
                                                       @"t" : tStr,
                                                       @"sign" : singMD5,
                                                       @"type" :type,
                                                       @"language":[HWjianzhiduiObject returnLanguageAcquisition],
                                                       };
               
               
               [HWWebUtils do4GetWithParameters:parametes hiddenparameterStr:HW_take_jiangli progress:nil success:^(id  _Nullable response) {
                   
                   NSString *codeStr =  [NSString stringWithFormat:@"%@",response[@"code"]];
                                  
                           if ([codeStr intValue] == 1) {
                                      
                                   
                               [self fasongwangluoqing];
                               
                                    
                                      
                                      
                           
                         } else  {
                                      
                                [MBProgressHUD showError:response[@"message"]];
                                      
                       }
                               
                   
               } failure:^(NSString *error) {
                   
                    [MBProgressHUD showError:@"兑换失败"];
                   
               }];
        
    }
    
    
       
           
    
    
}

@end
